package com.like.dialog;

import android.view.View;
import android.widget.TextView;

import com.like.entity.EventWrapper;
import com.like.shopmanager.R;

import org.greenrobot.eventbus.EventBus;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;

@ContentView(R.layout.dialog_confirm)
public class ConfirmDialogFragment extends BaseDialogFragment {

    public static final String TAG_OK = "tag_ok";

    @ViewInject(R.id.content)
    private TextView mContent;

    private String mAlertMsg = "";

    @Override
    protected void onSetPosition() {
        setPosition(0.8f, WRAP_CONTENT, DEFAULT_GRAVITY);
    }

    @Event(R.id.ok)
    private void okClick(View v) {
        EventBus.getDefault().post(new EventWrapper(null, TAG_OK));
    }

    @Override
    protected void onCreateView() {
        mContent.setText(mAlertMsg);
    }

    public void setMessage(String msg) {
        this.mAlertMsg = msg;
        if (mContent != null)
            mContent.setText(mAlertMsg);
    }

}
